package org.finesys.common.log.trace.spi;

import org.finesys.common.log.trace.spi.annotation.Join;
import org.finesys.common.log.trace.spi.annotation.SPI;

@Join
public class SpiExtensionFactory implements ExtensionFactory {

    @Override
    public <T> T getExtension(String key, Class<T> clazz) {
        if (clazz.isAnnotationPresent(SPI.class) && clazz.isInterface()) {
            ExtensionLoader<T> extensionLoader = ExtensionLoader.getExtensionLoader(clazz);
            return extensionLoader.getDefaultJoin();
        }
        return null;
    }
}